package com.yhm.testSpringMvc.Thread;

import java.util.concurrent.atomic.AtomicInteger;

public class AtomicClassTestBefore {


    private static Integer integer = new Integer(100);

    public static void main(String[] args) {
        for (int i = 0; i < 10; i++) {
            new Thread(new yhmDecrementClass()).start();
            new Thread(new yhmIncrementClass()).start();
        }

    }

    static class yhmIncrementClass implements Runnable {

        @Override
        public void run() {
            for (int i = 0; i < 10; i++) {
                System.out.println(Thread.currentThread().getName() + "," + integer++);
            }


        }
    }

    static class yhmDecrementClass implements Runnable {

        @Override
        public void run() {
            for (int i = 0; i < 10; i++) {
                System.out.println(Thread.currentThread().getName() + "," + integer--);
            }

        }
    }
}
